
from typing import Optional,List
from datetime import datetime
from uuid import UUID
from pydantic import BaseModel, EmailStr, AnyHttpUrl, validator, Field
from core.schemas.base import BaseResponse


class ClassroomCreate(BaseModel):
    building_name: str
    room_number: Optional[str]
    capacity: int = 100
    location: str

class ClassroomMapper(BaseModel):
    building_name: str
    object_name: Optional[str]

class ClassroomUpdate(BaseModel):
    building_name: str
    room_number: Optional[str]
    capacity: int = 100
    location: str

class DateTimeArray(BaseModel):
    reservationTime: List[str]  # 接收一个字符串列表，后续会转为 datetime 对象

    # 自定义方法来处理每个元素的转换
    def get_times_as_datetimes(self):
        # 使用 strptime 解析特定格式的时间字符串
        return [datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S") for time_str in self.reservationTime]
